import Ember from 'ember';
import BaseBusiness from '../base-business';
import Pagination from '../pagination';
const {bizTypeWithdra_wash} = Constants;
// import RouteMixin from 'ember-cli-3pagination/remote/route-mixin';

export default BaseBusiness.extend(Pagination,{
  header_title:'长者查看',
  model(){
    return ;
  },
  buildQueryParams(){
    var _self = this;
    var params = this.pagiParamsSet();
    // var curTask = this.get('global_curStatus').getTask().get('task');
    var curUser = this.get('global_curStatus').getUser();
    var curController = this.getCurrentController();
    var filter = {};
    var sort = {tradeTime:"desc"};
    params.sort = sort;
    filter = $.extend({},filter,{payer:{'id@$or1':curUser.get('id')},payee:{'id@$or1':curUser.get('id')}});
    // filter = $.extend({},filter,{task:{id:curTask.get('id')}});
    if(curController && (curController.get('chooseDateFrom') || curController.get('chooseDateTo'))){
      filter = $.extend({},filter,{'tradeTime@$lte':curController.get('a'),'tradeTime@$gte':curController.get('b')});
    }
    params.filter = filter;
    console.log("params is:",params);
    return params;
  },
  doQuery: function(){
    var _self = this;
    console.log('defaultCallaaaaaa');
    var params = this.buildQueryParams();//拼查询条件
    var tasklist = this.findPaged('deal-flow',params);
    if(_self.getCurrentController()){
      _self.getCurrentController().set("dealflowList",tasklist);
    }
  },
  // setStatus:function(list){
  //   list.forEach(function(item){
  //     console.log('item.get',item.get('businessType').get('typecode'));
  //     if(item.get('businessType').get('typecode') == bizTypeWithdra_wash){
  //       console.log('ininininininininin');
  //       item.set('amountSymbol','-'+item.get('amount'));
  //     }
  //     else{
  //       item.set('amountSymbol','+'+item.get('amount'));
  //     }
  //   });
  // },
  setupController(controller,model){
    this._super(controller,model);
    controller.set("params",{});
    controller.customerListObs();
  },
});
